import junit.framework.TestCase;
import org.junit.Test;
public class ComplexTest extends TestCase {
    Complex a = new Complex(2.0, 3.0);
    Complex b = new Complex(-2.0, 2.0);

    @Test
    public void testequals() {
        assertEquals(true, a.equals(a));
        assertEquals(true, b.equals(b));
    }

    @Test
    public void testtoString() {
        assertEquals("Complex{2.0,3.0}", a.toString());
        assertEquals("Complex{-2.0,2.0}", b.toString());
    }
    @Test
    public void testComplexAdd() {
        assertEquals(0.0,a.ComplexAdd(b).RealPart);
        assertEquals(5.0,a.ComplexAdd(b).ImagePart);
    }

    @Test
    public void testComplexSub() {
        assertEquals(4.0,a.ComplexSub(b).RealPart);
        assertEquals(1.0,a.ComplexSub(b).ImagePart);
    }

    @Test
    public void testComplexMulti() {
        assertEquals(-10.0,a.ComplexMulti(b).RealPart);
        assertEquals(-2.0,a.ComplexMulti(b).ImagePart);
    }

    @Test
    public void testComplexDiv() {
        assertEquals(0.25,a.ComplexDiv(b).RealPart);
        assertEquals(-1.25,a.ComplexDiv(b).ImagePart);
    }
}
